//                 _              
//                | |             
//   __ _ _ __ ___| |__ __  _____ 
//  / _` | '__/ __| '_ \\ \/ / __|
// | (_| | | | (__| | | |>  <\__ \
//  \__,_|_|  \___|_| |_/_/\_\___/
//                                
// Copyright 2010 Scott Dixon http://www.archxs.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package com.archxs.commons;

import java.util.Locale;

/**
 * Object cache used by {@link Variant#valueOf(String)} and it's overrides.
 */
public interface VariantObjectCache {

    final static String CACHE_IMPL_PROPERTY = "com.archxs.commons.javavariant.cache.impl";
    final static String CACHE_DEBUG_PROPERTY = "com.archxs.commons.javavariant.cache.debug";
    
    int getCacheSize();
    
    void clearCache();
    
    Variant readThroughCache(Class<? extends Variant> type, String value);
    Variant readThroughCache(Class<? extends Variant> type, String value, Locale locale);
    Variant readThroughCache(Class<? extends Variant> type, String[] value);
    Variant readThroughCache(Class<? extends Variant> type, String[] value, Locale locale);
    
    Variant getCachedValue(String value, Locale locale);
    Variant getCachedValue(String[] value, Locale locale);
    Variant getCachedValue(String value);
    Variant getCachedValue(String[] value);
    
    void setDebug(boolean debugOnOff);
    
}
